package com.css.fxfzaqbz.modules.data.controller;

import com.css.fxfzaqbz.base.response.RestResponse;
import com.css.fxfzaqbz.modules.data.entity.ImportantActivity;
import com.css.fxfzaqbz.modules.data.entity.Report;
import com.css.fxfzaqbz.modules.data.queryParams.ImportantActivityQueryParams;
import com.css.fxfzaqbz.modules.data.service.ImportantActivityService;
import com.css.fxfzaqbz.modules.data.service.ReportService;
import com.css.fxfzaqbz.util.PlatformPageUtils;
import com.css.fxfzaqbz.web.PlatformSessionContext;
import com.css.fxfzaqbz.zcpt.sys.service.SysAreaService;
import com.css.fxfzaqbz.zcpt.sys.service.impl.SUserServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 3.4.1重大活动安保管理子模块 -报告管理
 */
@RestController
@RequestMapping("/fxfzaqbz/data")
@Slf4j
public class ReportController {
//    @Resource
////    ReportService reportService ;
////
////
////    /**
////     * 新增Report
////     * @param report
////     * @return
////     */
////    @PostMapping("/saveReport")
////    public RestResponse saveReport (@RequestBody Report report){
////        RestResponse restResponse = null ;
////
////        try{
////            restResponse = RestResponse.succeed(reportService.saveReport(report));
////        }catch (Exception e){
////            log.error("新增报告管理失败",e);
////            restResponse = RestResponse.fail("新增报告管理失败!");
////        }
////        return restResponse;
////    }
////
////
////
////    /**
////     * 全查询  模糊查询未设定条件
////     * @param id
////     * @return
////     */
////    @GetMapping("/getAllReport")
////    public RestResponse getAllImportantActivity( String id){
////
////        RestResponse restResponse = null;
////        try{
////            restResponse = RestResponse.succeed(reportService.getAllReportById(id));
////        }catch (Exception e){
////            log.error("查询重大活动信息失败!",e);
////            restResponse = RestResponse.fail("查询重大活动信息失败");
////        }
////        return restResponse;
////    }
////
////    /**
////     * 根据id查询ImportantActivity数据
////     * @param id
////     * @return
////     */
////    @GetMapping("/getReport/{id}")
////    public RestResponse<ImportantActivity> getImportantActivity(@PathVariable("id") String id) {
////        RestResponse restResponse = null;
////        try{
////            restResponse = RestResponse.succeed(reportService.getReportById(id));
////        }catch (Exception e){
////            log.error("获取重大活动信息失败!",e);
////            restResponse = RestResponse.fail("获取重大活动信息失败!");
////        }
////        return restResponse;
////    }
////
////
////    /**
////     * 逻辑删除，修改数据标志位
////     * @param ids
////     * @return
////     */
////    @PostMapping("/delReport/{ids}")
////    public RestResponse deleteImportantActivity(@PathVariable("ids") List<String> ids) {
////        RestResponse restResponse = null;
////        try{
////
////            reportService.delReports(ids);
////            restResponse = RestResponse.succeed();
////        }catch (Exception e){
////            log.error("删除重大活动信息失败!",e);
////            restResponse = RestResponse.fail("删除重大活动信息失败!");
////        }
////        return restResponse;
////    }
//
////    /**
////     * 修改
////     * @param importantActivity
////     * @return
////     */
////    @PostMapping("/updateReport")
////    public RestResponse<ImportantActivity> updateImportantActivity(@RequestBody ImportantActivity importantActivity)  {
////        RestResponse restResponse = null;
////        try{
////
//            String provinceId = importantActivity.getProvinceId();
//            String cityId = importantActivity.getCityId();
//            String prefectureId = importantActivity.getCountiesId();
//            String address=provinceId+","+cityId+","+prefectureId;
//            String areaNameByAreaId = sysAreaService.getAreaNameByAreaId(address);
//            String[] split = areaNameByAreaId.split(",");
//            importantActivity.setIaProvince(split[0]);
//            importantActivity.setIaCity(split[1]);
//            importantActivity.setIaCounties(split[2]);
//
//            //获取用户名称
////            String sUser = sUserServiceImpl.getSUser(PlatformSessionContext.getUserID());
////            SUser userInfo = CreateGson.createGson().fromJson(sUser, SUser.class);
////            String userName = userInfo.getUserName();
//            String userName = "测试1";
//
//            restResponse = RestResponse.succeed(reportService.updateReport(importantActivity,userName));
//        }catch (Exception e){
//            log.error("修改重大活动信息失败!",e);
//            restResponse = RestResponse.fail("修改重大活动信息失败!");
//        }
//        return restResponse;
//    }



//    @GetMapping("/searchList")
//    public RestResponse<ImportantActivity> searchList(ImportantActivityQueryParams queryParams){
//        RestResponse restResponse  = null;
//        try{
//            restResponse = RestResponse.succeed(importantActivityService.searchList(queryParams));
//        }catch (Exception e){
//            log.error("查询重大活动信息失败!",e);
//            restResponse = RestResponse.fail("查询重大活动信息失败");
//        }
//        return restResponse;
//    }
}
